package nc.vo.ebscg.xyresultinform.portal.service;

import java.util.List;

import nc.bs.dao.BaseDAO;
import nc.jdbc.framework.processor.BeanListProcessor;
import nc.vo.ebscg.xyresultinform.ResultInfromVO;

public class ResultInformQueryServiceImpl 
implements IResultInformQueryService{

	private BaseDAO  dao = new BaseDAO();
	
	/*
	 * 
	 * (non-Javadoc)
	 * @see nc.vo.ebscg.xyresultinform.portal.service.IResultInformQueryService#queryInformByProject(java.lang.String, java.lang.String)
	 */
	public ResultInfromVO queryInformByProject(String pk_xy_proj_main,
			String pk_supplier) throws Exception {
		// TODO Auto-generated method stub
		
		
		String sql = " select a.pk_xy_result_inform_main," +
					" case when b.is_hit_supplier = 'Y' then 1 when b.is_hit_supplier = 'N' then 2 " +
					" when b.is_hit_supplier is null then 2 end inform_mode,a.pk_xy_proj_main,a.pk_xy_step_exec_state" +
					",a.result_inform_title,a.is_responsion,a.is_deposit,a.responsion_end_date,a.inform_content" +
					",a.is_upload_att "+
                     " from ebs_xy_result_inform_main a,ebs_xy_proj_item_sup_cfm b "+
                     " where a.billstatus=1 and a.pk_xy_proj_main = '"+pk_xy_proj_main+"' and "+
                     " b.pk_supplier =  '"+pk_supplier+"' and a.ispromulgate = 'Y'" +
                     " and a.pk_xy_result_inform_main = b.pk_xy_result_inform_main";
                  
		
		
		List<ResultInfromVO> list = (List<ResultInfromVO>)dao.executeQuery(sql, new BeanListProcessor(ResultInfromVO.class));
		
		if(list != null && list.size() >0)
		{
			return list.get(0);
		}
		
		return null;
	}

}
